<%@page import="sql.DBManagment"%>
<%@page import="sql.record.*"%>
<%@page import="java.util.*"%>
<%
	User loginUser = new User();
	loginUser.userName = (String) session.getAttribute("loggedUser");
	User storedUser = new User();
	try  {
		List<User> userList = DBManagment.getRecord(loginUser);
		storedUser = userList.get(0);
	}catch(Exception e){
%>
		<script type = "text/javascript" src = "script/end_session.js"></script>		
<%
	}
	
%>
<script type = "text/javascript" src = "script/profile.js"></script>
<div class="panel" align="justify">
	<span class="orangetitle"><%=session.getAttribute("loggedUser")%></span>
    <form name="profileForm" id="profileForm" class="userForm">
		<span class="bodytext"><br /><br />
		<label for="surName">Sur Name</label><input type="text" name="surName" id="surName" value=<%="\""+storedUser.surName+"\"" %>/><span id="surNameErr" class="errSpan"></span><br/>
		<label for="givenName">Given Name</label><input type="text" name="givenName" id="givenName" value=<%="\""+storedUser.givenName+"\"" %>/><span id="givenNameErr" class="errSpan"></span><br/>
		<label for="phoneNumber">Phone Number</label><input type="text" name="phoneNumber" id="phoneNumber" value=<%="\""+storedUser.phoneNumber+"\"" %>/><span id="phoneNumberErr" class="errSpan"></span><br/><br />
		<label for="password1">Password</label><input type="password" name="password1" id=<%="\""+storedUser.password+"\"" %> /><span id="password1Err" class="errSpan"></span><br/>
		<label for="password2">Confirm Password</label><input type="password" name="password2" id=<%="\""+storedUser.password+"\"" %> /><span id="password2Err" class="errSpan"></span><br/><br/>
		<span id="result" class="errSpan"></span><br/>                        
		<input type="button" name="updateBtn" id="updateBtn" value="Update" /><br/>
		</span>
	</form>
</div>
